import { IPSSysDBIndex } from './ipssys-dbindex';
import { IPSSysDBIndexColumn } from './ipssys-dbindex-column';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysDBIndexImpl extends PSModelObjectImpl implements IPSSysDBIndex {
  protected allpssysdbindexcolumns: IPSSysDBIndexColumn[] | null = null;

  getAllPSSysDBIndexColumns(): IPSSysDBIndexColumn[] | null {
    if (this.allpssysdbindexcolumns == null) {
      this.allpssysdbindexcolumns = this.fillChildListModel(this.M.getAllPSSysDBIndexColumns, 'database.IPSSysDBIndexColumn') as IPSSysDBIndexColumn[];
    }
    return this.allpssysdbindexcolumns;
  }

  get allPSSysDBIndexColumns(): IPSSysDBIndexColumn[] | null {
    return this.getAllPSSysDBIndexColumns();
  }

  findPSSysDBIndexColumn(objKey: any): IPSSysDBIndexColumn | null {
    return this.getPSModel5('database.IPSSysDBIndexColumn', this.getAllPSSysDBIndexColumns(), objKey) as IPSSysDBIndexColumn;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get indexType(): 'NORMAL' | 'UNIQUE' {
    return this.M.indexType;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get removeFlag(): boolean {
    return this.M.removeFlag != null ? this.M.removeFlag : false;
  }

  get sourceType(): 'DEDBINDEX' | 'DER' {
    return this.M.sourceType;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get allowReverse(): boolean {
    return this.M.allowReverse != null ? this.M.allowReverse : false;
  }

  get cls(): string {
    return 'PSSysDBIndexImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelObject' || cls == 'IPSObject' || cls == 'database.IPSDBIndexBase' || cls == 'database.IPSSysDBIndex') return true;
    return super.instanceof(cls);
  }
}
